# -*- coding: utf-8 -*-
# Author: jurrabi <jurrabi@gmail.com>
# URL: http://code.google.com/p/mytvalacarta//
#
# This file is part of myTValacarta.
#
# myTValacarta is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# myTValacarta is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with myTValacarta.  If not, see <http://www.gnu.org/licenses/>.
'''
Created on 22/08/2010
@author: jurrabi

The module sets (reads) the default constants set.

Reads and manages configuration files.
In the XBMC version the plugin configuration has 2 parts:
  * An internal configuration file not accessed by the gui
  * XBMC plugin configuration options. Accessed from the gui.
'''

from tools import logger
logger.debug("[config]Init")

import os

try:
    import xbmc
    XBMC = True
except:
    XBMC = False

try:
    import xbmcaddon
    DHARMA = True
except ImportError:
    DHARMA = False

PLUGIN_ID = "plugin.video.myTValacarta"

if DHARMA and XBMC:
    __settings__ = xbmcaddon.Addon(id=PLUGIN_ID)
    __language__ = __settings__.getLocalizedString
    DATA_PATH = xbmc.translatePath("special://profile/addon_data/%s" % PLUGIN_ID)
else:
    DATA_PATH = os.path.join(os.getcwd(),'data')
if not os.path.exists(DATA_PATH):
    logger.info("[config] Library path doesn't exist, creating: "+DATA_PATH)
    os.mkdir(DATA_PATH)

SBDB_PATH = DATA_PATH

GUI_MODE = 'xbmc_plugin'